<template>
  <Particles
    id="bg-particles"
    class="bg-particles"
    :particlesLoaded="particlesLoaded"
    :particlesInit="particlesInit"
    :options="particles"
  ></Particles>
</template>

<script lang="ts">
import { defineComponent, reactive } from "vue";
import { loadFull } from "tsparticles";
export default defineComponent({
  name: "bg-particles",
  setup() {
    const particles = reactive<any>({
      background: {
        opacity: 100,
      },
      fpsLimit: 80,
      interactivity: {
        events: {
          onClick: {
            enable: true,
            mode: "push",
          },
          onHover: {
            enable: true,
            mode: "repulse",
          },
          resize: true,
        },
        modes: {
          bubble: {
            distance: 400,
            duration: 2,
            opacity: 0.8,
            size: 40,
          },
          push: {
            quantity: 4,
          },
          repulse: {
            distance: 200,
            duration: 0.4,
          },
        },
      },
      particles: {
        color: {
          value: "#6AECFF",
        },
        links: {
          color: "#6AECFF",
          distance: 150,
          enable: true,
          opacity: 0.5,
          width: 1,
        },
        collisions: {
          enable: true,
        },
        move: {
          direction: "none",
          enable: true,
          outMode: "bounce",
          random: false,
          speed: 4,
          straight: false,
        },
        number: {
          density: {
            enable: true,
            area: 800,
          },
          value: 60,
        },
        opacity: {
          value: 0.5,
        },
        shape: {
          type: "circle",
        },
        size: {
          random: true,
          value: 5,
        },
      },
      detectRetina: true,
    });
    const particlesLoaded = async (container) => {};
    const particlesInit = async (engine) => {
      await loadFull(engine);
    };
    return {
      particles,
      particlesLoaded,
      particlesInit,
    };
  },
});
</script>
<style lang="less">
.bg-particles {
  height: 100%;
  width: 100%;
  background-size: cover;
  background-repeat: no-repeat;
}
</style>
